﻿using System;
using System.Collections.Generic;

namespace ETModel
{
	[Flags]
	public enum AppType
	{
		None = 0,
        /// <summary>
        /// 管理服务器
        /// </summary>
		Manager = 1,
        /// <summary>
        /// 认证服务器
        /// </summary>
		Realm = 1 << 1,
        /// <summary>
        /// 网关服务器
        /// </summary>
		Gate = 1 << 2,
        /// <summary>
        /// web服务器
        /// </summary>
		Http = 1 << 3,
        /// <summary>
        /// 数据库服务器
        /// </summary>
		DB = 1 << 4,
        /// <summary>
        /// id->actorId 定位服务器
        /// </summary>
		Location = 1 << 5,
        /// <summary>
        /// 地图服务器
        /// </summary>
		Map = 1 << 6,
        /// <summary>
        /// 地图观众服务器
        /// </summary>
        MapAudience = 1 << 7,

        BenchmarkWebsocketServer = 1 << 26,

		BenchmarkWebsocketClient = 1 << 27,
		Robot = 1 << 28,
		Benchmark = 1 << 29,
        /// <summary>
        /// 客户端Hotfix层
        /// </summary>
        ClientH = 1 << 30,
        /// <summary>
        /// 客户端Model层
        /// </summary>
        ClientM = 1 << 31,

        /// <summary>
        /// 11111111
        /// 所有服务器都包含在内
        /// </summary>
        AllServer = Manager | Realm | Gate | Http | DB | Location | Map | MapAudience | BenchmarkWebsocketServer
	}

	public static class AppTypeHelper
	{
		public static List<AppType> GetServerTypes()
		{
			List<AppType> appTypes = new List<AppType> { AppType.Manager, AppType.Realm, AppType.Gate };
			return appTypes;
		}

		public static bool Is(this AppType a, AppType b)
		{
			if ((a & b) != 0)
			{
				return true;
			}
			return false;
		}
	}
}